import https from 'https';
import http from 'http';
import fs from 'fs';
import SocketIO from 'socket.io';
/*
对于https的模块，可以参考这里
    const credentials = {
      key: fs.readFileSync('ntask.key', 'utf8'),
      cert: fs.readFileSync('ntask.cert', 'utf8'),
    };
    app.db.sequelize.sync().done(() => {
      https.createServer(credentials, app)
        .listen(app.get('port'), () => {
          console.log(`zhubo  - Port ${app.get('port')}`);
        });
    });
 */

module.exports = app => {  
    const config = app.libs.config
    app.db.sequelize.sync().done(() => {
        let server = http.createServer(app)
        server.listen(config.http.port, () => {
            console.log(`utilapi - Port ${config.http.port}`);
        });
    });
};
